home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / dde2 / ddeww.frm < prev    next >
Text File  |  1993-05-16  |  5KB  |  159 lines

  1. VERSION 2.00
  2. Begin Form Form1 
  3.    Caption         =   "DDE Client  to WinWord"
  4.    ClientHeight    =   3855
  5.    ClientLeft      =   1065
  6.    ClientTop       =   1485
  7.    ClientWidth     =   7365
  8.    Height          =   4260
  9.    Left            =   1005
  10.    LinkMode        =   1  'Source
  11.    LinkTopic       =   "Form1"
  12.    ScaleHeight     =   3855
  13.    ScaleWidth      =   7365
  14.    Top             =   1140
  15.    Width           =   7485
  16.    Begin Frame Frame1 
  17.       Caption         =   "Link Options"
  18.       Height          =   1335
  19.       Left            =   5280
  20.       TabIndex        =   6
  21.       Top             =   1680
  22.       Width           =   1815
  23.       Begin OptionButton optManualLink 
  24.          Caption         =   "Manual link"
  25.          Height          =   255
  26.          Left            =   240
  27.          TabIndex        =   8
  28.          Top             =   840
  29.          Width           =   1455
  30.       End
  31.       Begin OptionButton optAutoLink 
  32.          Caption         =   "Auto link"
  33.          Height          =   255
  34.          Left            =   240
  35.          TabIndex        =   7
  36.          Top             =   360
  37.          Width           =   1335
  38.       End
  39.    End
  40.    Begin TextBox Text1 
  41.       Height          =   975
  42.       Left            =   720
  43.       MultiLine       =   -1  'True
  44.       TabIndex        =   0
  45.       Top             =   2040
  46.       Width           =   1815
  47.    End
  48.    Begin CommandButton Poke 
  49.       Caption         =   "Poke"
  50.       Height          =   375
  51.       Left            =   3120
  52.       TabIndex        =   1
  53.       Top             =   1680
  54.       Width           =   1695
  55.    End
  56.    Begin CommandButton request 
  57.       Caption         =   "Request"
  58.       Height          =   375
  59.       Left            =   3120
  60.       TabIndex        =   2
  61.       Top             =   2280
  62.       Width           =   1695
  63.    End
  64.    Begin Label Label4 
  65.       Caption         =   "Text1"
  66.       Height          =   255
  67.       Left            =   720
  68.       TabIndex        =   9
  69.       Top             =   1800
  70.       Width           =   495
  71.    End
  72.    Begin Label Label1 
  73.       Alignment       =   2  'Center
  74.       AutoSize        =   -1  'True
  75.       BorderStyle     =   1  'Fixed Single
  76.       Caption         =   "This application links to a Word for Windows document: "
  77.       FontBold        =   -1  'True
  78.       FontItalic      =   0   'False
  79.       FontName        =   "MS Sans Serif"
  80.       FontSize        =   9.75
  81.       FontStrikethru  =   0   'False
  82.       FontUnderline   =   0   'False
  83.       Height          =   270
  84.       Left            =   600
  85.       TabIndex        =   3
  86.       Top             =   120
  87.       Width           =   5820
  88.    End
  89.    Begin Label Label2 
  90.       Alignment       =   2  'Center
  91.       BorderStyle     =   1  'Fixed Single
  92.       Caption         =   "Word for Windows will be started and Text1 will be linked to the file SOURCE.DOC.  That file must have a bookmark DDE_LINK."
  93.       FontBold        =   -1  'True
  94.       FontItalic      =   0   'False
  95.       FontName        =   "MS Sans Serif"
  96.       FontSize        =   9.75
  97.       FontStrikethru  =   0   'False
  98.       FontUnderline   =   0   'False
  99.       Height          =   855
  100.       Left            =   960
  101.       TabIndex        =   4
  102.       Top             =   600
  103.       Width           =   5175
  104.    End
  105.    Begin Label Label3 
  106.       Alignment       =   2  'Center
  107.       BorderStyle     =   1  'Fixed Single
  108.       Caption         =   "Assumes c:\winword\winword.exe"
  109.       Height          =   255
  110.       Left            =   1920
  111.       TabIndex        =   5
  112.       Top             =   3360
  113.       Width           =   3255
  114.    End
  115. End
  116. Option Explicit
  117.  
  118. Const NONE = 0         ' 0 - None
  119. Const LINK_SOURCE = 1    ' 1 - Source (forms only)
  120. Const LINK_AUTOMATIC = 1 ' 1 - Automatic (controls only)
  121. Const LINK_MANUAL = 2    ' 2 - Manual (controls only)
  122. Const LINK_NOTIFY = 3    ' 3 - Notify (controls only)
  123.  
  124. Sub AutomaticLink_Click ()
  125.     Request.Enabled = False
  126.     Text1.LinkMode = NONE
  127.     Text1.LinkMode = LINK_AUTOMATIC
  128. End Sub
  129.  
  130. Sub Form_Load ()
  131.     Dim rc As Integer
  132.     
  133.     rc = Shell("c:\winword\winword c:\vbdemos\dde\source.doc", 1)
  134.     rc = DoEvents()
  135.     Text1.LinkMode = NONE
  136.     
  137.     'Be sure document is not maximized in Winword -
  138.     'Winword title bar should be Microsoft Word - NOT "Microsoft Word - Document1"
  139.     Text1.LinkTopic = "WinWord|\vbdemos\dde\source"
  140.     Text1.LinkItem = "dde_link"
  141.     Text1.LinkMode = LINK_MANUAL
  142.     optManualLink.Value = True
  143. End Sub
  144.  
  145. Sub ManualLink_Click ()
  146.     Request.Enabled = True
  147.     Text1.LinkMode = NONE
  148.     Text1.LinkMode = LINK_MANUAL
  149. End Sub
  150.  
  151. Sub Poke_Click ()
  152.     Text1.LinkPoke
  153. End Sub
  154.  
  155. Sub Request_Click ()
  156.     Text1.LinkRequest
  157. End Sub
  158.  
  159.